package Text20;

import java.util.*;

public class Main {
    //    对于一个给定的正整数，可能存在多种平方和的表示法。
//    要求你对 4个数排序：0≤a≤b≤c≤d
    static int N = 2500010;
    static int n, m;
    static sum[] sums = new sum[N];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        for (int c = 0; c * c <= n; c++) {
            for (int d = c; d * d + c * c <= n; d++) {
                sums[m++] = new sum(c * c + d * d, c, d);
            }
        }
        Arrays.sort(sums, 0, m);
        for (int a = 0; a * a < n; a++) {
            for (int b = 0; b * b + a * a < n; b++) {
                int t = n - a * a - b * b;
                int l = 0;
                int r = m - 1;
                while (l < r) {
                    int mid = l + r >> 1;
                    if (sums[mid].s >= t) {
                        r = mid;
                    } else {
                        l = mid + 1;
                    }
                }
                if (sums[l].s == t) {
                    System.out.println(a + " " + b + " " + sums[l].c + " " + sums[l].d);
                    return;
                }
            }
        }
    }
}

class sum implements Comparable<sum> {
    public int s, c, d;

    public sum(int s, int c, int d) {
        this.s = s;
        this.c = c;
        this.d = d;
    }

    @Override
    public int compareTo(sum o) {
        if (this.s != o.s) {
            return Integer.compare(this.s, o.s);
        }
        if (this.c != o.c) {
            return Integer.compare(this.c, o.c);
        }
        return Integer.compare(this.d, o.d);
    }
}
